package com.feilong.cn.mybatis.Auto;

import java.lang.reflect.Proxy;
import java.util.HashMap;
import java.util.Map;

/**
 * Created by yangxulong on 2018/4/2.
 */
public class AutoConfiguration {

    public <T> T getMapper(Class<T> clazz, AutoSqlSession session) {
        AutoMapperProxy proxy = new AutoMapperProxy(session);
        return (T) Proxy.newProxyInstance(this.getClass().getClassLoader(), new Class[]{clazz}, proxy);


    }

   public static class XMLParser {
        static Map mapSqls = new HashMap<>();

        static {
            mapSqls.put("com.feilong.cn.mybatis.Auto.TestMapper.selectByPrimaryKey", "select *from User where id=?");
        }

        static String GetStatemenet(String strKey) {
            return String.valueOf(mapSqls.get(strKey));
        }

    }

}
